<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>展示页面</title>
    <%-- BootStrap美化界面 --%>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <h1>用户展示</h1>
    <div class="container">
        <div class="row clearfix">
            <div class="col-md-12 column">
                <div class="page-header">
                    <h1>用户列表--显示所有用户</h1>
                </div>
            </div>
            <div class="row">
                <div class="col-md-4 colum">
                    <a class="btn btn-default" href="${pageContext.request.contextPath}/user/toAddPage">新增书籍</a>
                    <a class="btn btn-default" href="${pageContext.request.contextPath}/user/allUser">显示书籍</a>
                    <span style="color: red;font-weight: bold">${queryError} </span>
                </div>
                <div class="col-md-4 colum">
                   <%-- 查询 --%>
                    <form class="form-inline" action="${pageContext.request.contextPath}/user/getUserByName" method="post" style="float: right">
                        <input type="text" id="username" name="username" class="form-control" placeholder="输入查询的用户名">
                        <input type="submit" value="查询" class="btn btn-default">
                    </form>
                </div>
            </div>


        </div>

        <div class="row clearfix">
            <div class="col-md-12 column">
                <table class="table table-hover table-striped">
                    <thead>
                        <tr>
                            <th>id</th>
                            <th>用户名</th>
                            <th>密码</th>
                            <th>邮箱</th>
                            <th>手机</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <%--书籍从数据库中查询出来，从list中便利出来 ：foreach--%>
                    <tbody>
                        <c:forEach var="user" items="${PageInfo.list}" >
                            <tr>
                                <td>${user.uid}</td>
                                <td>${user.username}</td>
                                <td>${user.pwd}</td>
                                <td>${user.email}</td>
                                <td>${user.tel}</td>
                                <td>
                                    <a class="btn btn-default" href="${pageContext.request.contextPath}/user/toUpdatePage?uid=${user.uid}">修改</a>
                                    |&nbsp;&nbsp;
                                    <a class="btn btn-default" href="${pageContext.request.contextPath}/user/deleteUser?uid=${user.uid}">删除</a>
                                </td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>
                <div style="float: right">
                    <ul class="pagination pagination-right">
                        <li><a href="${pageContext.request.contextPath}/user/allUser?page=1&size=${PageInfo.pageSize}" >首页</a></li>
                        <li><a href="${pageContext.request.contextPath}/user/allUser?page=${PageInfo.pageNum-1}&size=${PageInfo.pageSize}">上一页</a></li>
                        <c:forEach begin="${PageInfo.pageNum}" end="${PageInfo.pageNum+2}" var="pageNum">
                            <li><a href="${pageContext.request.contextPath}/user/allUser?page=${pageNum}&size=${PageInfo.pageSize}" >${pageNum}</a></li>
                        </c:forEach>
                        <li><a href="${pageContext.request.contextPath}/user/allUser?page=${PageInfo.pageNum+1}&size=${PageInfo.pageSize}" >下一页</a></li>
                        <li><a href="${pageContext.request.contextPath}/user/allUser?page=${PageInfo.pages}&size=${PageInfo.pageSize}">尾页</a></li>
                    </ul>
                </div>


            </div>
        </div>


    </div>

</body>
</html>
